home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
UTILSTEM
/
HACKROM.LZH
/
ROMSPLIT.C
< prev
next >
Wrap
Text File
|
1985-12-31
|
834b
|
36 lines
/* This program is designed to split a file into two files such
that each of the target files represents streams of bytes from
alternate locations in the source file. Used to make hi / lo
proms for 16 bit systems. Uses a file called temp as its input
and produces two files called tempevn and tempodd as its output.
*/
#include <stdio.h>
#include <stdlib.h>
main(argc,argv)
{
int c;
FILE *fp1, *fp2, *fp3;
if ((fp1 = fopen("temp","rb")) == NULL)
{
perror("Can't open temp");
exit(0);
}
fp2 = fopen("tempevn","wb");
fp3 = fopen("tempodd","wb");
while ((c = getc(fp1)) != EOF)
{
putc(c, fp2);
if ((c = getc(fp1)) == EOF)
{
fclose(fp2);
fclose(fp3);
printf("Warning - odd number of bytes in temp\n");
exit(0);
}
putc(c, fp3);
}
fclose(fp2);
fclose(fp3);
exit(0);
}